import request from '@/utils/request'


export function addMenu (data) { //新增菜单
  return request({
    url: '/upms/menu',
    method: 'post',
    data
  })
}

export function addOperation (data) {//新增菜单操作
  return request({
    url: '/upms/operation',
    method: 'post',
    data
  })
}
//其实方法和参数可以传过来用一个 函数，但是我没有这样做， 你可以改一下

export function delOperation (operationId) {//删除资源
  return request({
    url: '/upms/operation',
    method: 'DELETE',
    params: {operationId}
  })
}

export function updateOperation(data) {//更新资源
  return request({
    url: '/upms/operation',
    method: 'put',
    data
  })
}

export function compileMenu (data) {//编辑菜单
  return request({
    url: '/upms/menu',
    method: 'put',
    data
  })
}

export function delMenu (menuId) {//删除菜单
  return request({
    url: '/upms/menu',
    method: 'DELETE',
    params: {menuId}
  })
}

export function allMenu () {//查询所有菜单
  return request({
    url: '/upms/menu/all',
    method: 'get',
  })
}

export function operation (menuId) {//获取所有资源
  return request({
    url: '/upms/operation',
    method: 'get',
    params : {menuId}
  })
}
